<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<%@ include file="/common/meta.jsp"%>
<%@ include file="/common-app/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.t_css input { padding:2px 8px 0pt 3px; height:20px; _height:22px ;border:1px solid #a1c0dc; background-color:#FFF; }
</style>

<title>添加申报特例</title>
<script type="text/javascript"
	src="${res}/js/exception/irisException.js"></script>
<script type="text/javascript" src="${res}/js/validate/irisvalidator.js"></script>
<script type="text/javascript" src="${res}/js/jquery/jquery.form.js"></script>
<script type="text/javascript" src="${res}/js/jquery/jquery.json.js"></script>

<script type="text/javascript">
	function initOnlyChooseLeaf(params, treeNode) {
		
		scmWarn("请选择具体的业务类别");
		$("#scmtip_container").css("z-index", '999999999');
			return false;
	}

	var prcWin = new progressWin("${res}");//初始化遮罩层
	$(function() {

		$("table.t_css").each(function() {
			$(this).find("tr:even").addClass("li_1");
			$(this).find("tr:odd").addClass("li_2");
		});

		$("#wbox1").click(function() {
		});

		initControl();

	});

	function check() {

		validate($("#prpMsg"), "");

		if (!valResult()) {
			irisValShowMsg($("#wbox1"));
			return false;
		}

		return true;
	}
	function submitValue() {
		if (check()) {
				var submitFlag = 0;
				if($("#prpMsg input[name='submitFlag']").attr("checked") == "checked"){
					submitFlag = 1;
				}
			var grantCode = $("#id_hideId").val();
			var psnCode = $("#psn_code").val();
			var orgType = $("#org_type1").val();
			var endDate = $("#endDate").val();
			var statYear = $("#statYear").val();
			var remark = $("#remark").val();
			var excludeRules =$("#rule_value").val();
			var parameters = "{'grantCode':'" + grantCode + "','psnCode':'"
					+ psnCode + "','orgType':'" + orgType
					+ "','endDate':'" + endDate + "','excludeRules':'" + excludeRules + "','submitFlag':'"
					+ submitFlag + "','statYear':'" + statYear + "','remark':'"
					+ encodeURIComponent(remark) + "'}";
			var options = {
				type : 'post',
				data : {
					'parameters' : parameters
				},
				beforeSend : function() {
				}, // 表单提交前的回调函数
				success : function(msg) {
					if (msg == 'SQLError') {
						prcWin.closeWin();// 关闭遮罩层
						scmError("操作失败！");
					} else if (msg == 'exists') {
						prcWin.closeWin();// 关闭遮罩层
						scmWarn('该申报特例已经存在，不可重复新增！', null, 3000);
					} else {
						prcWin.closeWin();// 关闭遮罩层
						scmSuccess('操作成功！', null, 3000);
						back();

					}
				},// 表单成功提交后的回调函数
				error : function() {
					scmError("操作失败！");
					prcWin.closeWin();
				},
				url : "${ctx}/prpapprove/saveGrantSpecial"
			};

			$.ajax(options);

	}

	}
	
	function removeValue(){
		$(':input','#prpMsg') .not(':button, :submit, :reset, :hidden') .val('') .removeAttr('checked') .removeAttr('selected');
	}
	
	function addPsnName() {

		tb_show(
				"人员查询",
				ctx
						+ "/prpapprove/addPsnName?flag=main&TB_iframe=true&height=270&width=680",
				false);
	}

	function checkGrantCode2(a, b) {
		if (b.isParent) {
			scmWarn("请选择具体的类别", null, "1000");
			$("#scmtip_container").css("z-index", '999999999');
			return false;
		}
		checkGrantCode(b.id, 'grant_exception');
	}
</script>
</head>

<body>
	<input id="wbox1" type="hidden" />
	<table class="t_css" width="100%" border="0" cellpadding="0" cellspacing="0" id="prpMsg">

		<tr>
			<td align="right" width="25%"><span class="color_red">*</span>项目类别：</td>
			<td colspan="1" width="25%" id="td_grant">
				<cpt:tree id="id" key="grant_codes"  topCheckbox="false" onlyChooseLeaf="true" readonly="true" className="required" label="项目类别" width="150px"></cpt:tree>
			</td>
			<td align="right" width="25%"><span class="color_red">*</span>项目负责人：</td>
			<td width="25%">
				<input type="text" id="psn_name" name="psn_name" disabled style="width: 150px;height: 20px" class="required" label="项目负责人" maxlength="50" value="">
				<input type="hidden" name="psn_code" id="psn_code" value="" />
				<input type="button" class="button_02" id="selectPsn" style="height: 20px; padding: 1px;" value="检索" onclick="addPsnName();">
			</td>
		</tr>
		<tr>			
			<td align="right" width="25%"><span class="color_red">*</span>组织形式：</td>
			<td colspan="1" width="25%"><cpt:select id="org_type1"
					style="width:150px" key="proposal_nature1" label="组织形式"
					className="required"></cpt:select></td>
			
			<td align="right" width="25%"><span class="color_red">*</span>截止日期：</td>
			<td colspan="1" width="25%"><cpt:date id="endDate" name="endDate" value="" size="" className=" required date" label="截止日期"></cpt:date></td>
		</tr>
		<tr>
			<td align="right" width="25%"style="border: 0px solid">直接提交至省科技厅：</td>
				<td align="left" style="border: 0px solid" width="25%">
				<c:if test="${submitFlag == 1 }">
				<input style="border: 0px solid" type="checkbox" name="submitFlag" checked="checked" />
				</c:if>
				<c:if test="${submitFlag == 0 || submitFlag == null}">
				<input style="border: 0px solid" type="checkbox" name="submitFlag" />
				</c:if>
				</td>
		<td align="right" width="25%">
				<span class="color_red">*</span>年度：
			</td>
			<td colspan="1" width="25%">
				<cpt:select id="statYear" style="width:150px" key="stat_year2" label="年度" className="required"></cpt:select>
			</td>
		</tr>
   <tr id="rule_exception" >
			<td align="right">选择跳过的业务规则：</td>
			<td colspan="3">
			 <cpt:checkbox key="grant_exception1" name="rule" width="100%"
					repeatColumn="1" style="border: 0px; padding: 0px; margin: 0px;"  ></cpt:checkbox>
				<input name="rule_value" id="rule_value" value="" type="hidden">
			</td>
		</tr> 
		<tr>
			<td align="right"><span class="color_red">*</span>备注：</td>
			<td colspan="3"><textarea style="WIDTH: 600px" name="remark"
					rows="5" id="remark" class="required" label="备注"  maxlength="500"></textarea></td>
		</tr>

	</table>
	<div class="bar_btn02" align="center">
	<input type="button"
			class="button_01" value=" 返 回 " onclick="cancel();" />&nbsp; 
		<input type="button" class="button_01" value=" 提 交 "
			onclick="submitValue();" /> &nbsp; <input type="button" class="button_01" value=" 重 置 "
			onclick="removeValue();" /> 
	</div>



</body>
</html>